package com.han.spring.core.container_extension;

import javax.sql.DataSource;

import org.apache.commons.dbcp2.BasicDataSource;
import org.junit.Test;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

/**
* @author hanpeng
* @version 创建时间：2020年7月7日 下午9:32:53
* @ClassName 类名称
* @Description 类描述
*/
public class ContainerExtensionTest {
	@Test
	public void beanPostProcessorTest() {
		ApplicationContext context = new ClassPathXmlApplicationContext("container_extension.xml");
		Post bean = context.getBean("post", Post.class);
		System.out.println(bean);
	}
	@Test
	public void getDataSource() {
		ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext("container_extension.xml");
		DataSource bean = context.getBean("dataSource", BasicDataSource.class);
		System.out.println(bean);
		context.registerShutdownHook();
	}
	@Test
	public void overrideTest() {
		ApplicationContext context = new ClassPathXmlApplicationContext("container_extension.xml");
		Post bean = context.getBean("post", Post.class);
		System.out.println(bean);
	}
}
